<?php if ($pk != null) { ?>
<div id="pk_box" class="pk_box">
    <script type="text/javascript">
        function vote(idx) {
            $.ajax({
                type: "POST",
                url: "<?php echo url_for('celebrityPk/vote') ?>",
                data: "pkId=<?php echo $pk->getCelebrityPkId()  ?>&idx=" + idx,
                success: renderResult
            });

        }
        function renderResult(content) {
            if (content == '0') {
                alert('您刚刚投票过，五分钟内不能重复投票');
            }
            else {
                $('#pk_box').html(content);
                alert("投票成功！");
            }
        }
    </script>
    <div class="pk_left_num">
        <!--            <div style="height: 25%;overflow: hidden;"><img src="images/pk_left.jpg"></div>-->
        <div style="background: url(/images/pk_left.jpg) no-repeat center center;height: 110px; ">
            <div style="background:#fff;height:<?php echo $left; ?>%">&nbsp;</div>
        </div>
        <p><?php echo $v1; ?></p></div>
    <div class="pk_img">
        <div class="pk_pic">
            <img class="pk_img1" src="<?php echo url_for($pk->getCelebrity()->getSnapshot_big()) ?>"
                 onclick="location.href='<?php echo url_for("celebrity/detail?celebrityId=" . $pk->getCelebrity1Id()); ?>'">
            <img class="pk_img2" src="<?php echo url_for($pk->getCelebrity2()->getSnapshot_big()) ?>"
                 onclick="location.href='<?php echo url_for("celebrity/detail?celebrityId=" . $pk->getCelebrity2Id()); ?>'">
            <!--            --><?php
//            echo link_to("<img  class='pk_img1' src='" . $pk->getCelebrity()->getSnapshot_big() . "'  />",
            //                         "celebrity/detail?celebrityId=" . $pk->getCelebrity1Id(), "target='_blank'  style='margin-right: 11px;'");
            //            echo link_to("<img  class='pk_img2' src='" . $pk->getCelebrity2()->getSnapshot_big() . "'  />",
            //                         "celebrity/detail?celebrityId=" . $pk->getCelebrity2Id(), "target='_blank'");
            //            ?>
            <img class="pk_word" src="/images/pk.gif">
        </div>
        <div class="pk_select"><a role='button' class="pk01" onclick="vote(1)"></a><a role='button' class="pk02"
                                                                                      onclick="vote(2)"></a></div>
    </div>
    <div class="pk_right_num">
        <div style="background: url(/images/pk_right.jpg) no-repeat center center;height: 110px; ">
            <div style="background:#fff;height:<?php echo $right; ?>%">&nbsp;</div>
        </div>

        <p><?php echo $v2;  ?></p></div>
</div>
<?php } ?>